package com.skycode6.servlet;

import com.mysql.cj.protocol.x.Notice;
import com.skycode6.dao.NoticeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/noticedetail.html")
public class NoticeDetailServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String NoticeID = request.getParameter("NoticeID");
        int noticeID = Integer.parseInt(NoticeID);
        Notice notice = (new NoticeDao()).getNoticeByID(noticeID);
        request.setAttribute("title", notice.getType());
        request.setAttribute("content", notice.getType());
        request.getRequestDispatcher("front/newsFrontDetail.jsp").forward(request, response);
    }
}